package com.na.qwr;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.function.Consumer;

/**
 * @Author: Qingwr
 * @Date: 2022/8/13 21:59
 * @Description //TODO 文件描述
 */
public class OrderReducer extends Reducer<Text, LongWritable, Text, LongWritable> {

    @Override
    protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException {
        long salar = 0;
        //迭代去最大值
        for (LongWritable value : values) {
            if(value.get() > salar){
                salar = value.get();
            }
        }
        context.write(key,new LongWritable(salar));
    }
}
